<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sitemesh" uri="http://www.opensymphony.com/sitemesh/decorator" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>

<div class="panel_container">
    <div class="panel">
        <form id="formId" method="post" action="${ctx}/guarantee/addGuarantee">
            <div class="panel_header">
                <div><h2>添加担保</h2></div>
            </div>
            <div class="panel_body">
                <div>
                    <div>
                        <div class="info_item"><span>担保机构组织机构代码:</span><b>*</b>
                           <input type="text" name="dbjgzzdm" />
                        </div>

                        <div class="info_item"><span>担保业务合同号:</span><b>*</b>
                            <input type="text" name="dbhth" />
                        </div>

                        <div class="info_item"><span>被担保人组织机构代码:</span><b>*</b>
                            <input type="text" name="bdbrzzjgdm"  />
                        </div>
                    </div>


                    <div>
                        <div class="info_item"><span>数据时间:</span><b>*</b>
                            <input type="text" name="sjsj" id="sjsj" />
                        </div>

                        <div class="info_item"><span>币种:</span><b>*</b>
                            <input type="text" name="bz" />
                        </div>

                        <div class="info_item"><span>担保业务种类:</span><b>*</b>
                            <input type="text" name="dbywzl" />
                        </div>
                    </div>

                    <div>
                        <div class="info_item"><span>担保余额:</span><b>*</b>
                            <input type="text" name="dbye" />
                        </div>

                        <div class="info_item"><span>担保开始日期:</span><b>*</b>
                            <input type="text" name="dbksrq" id="dbksrq" />
                        </div>

                        <div class="info_item"><span>担保到期日期:</span><b>*</b>
                            <input type="text" name="dbdqrq" id="dbdqrq"  />
                        </div>
                    </div>

                    <div>
                        <div class="info_item"><span>五级分类:</span><b>*</b>
                            <input type="text" name="wjfl" />
                        </div>

                        <div class="info_item"><span>当月代偿发生金额:</span><b>*</b>
                            <input type="text" name="dydcfsje" />
                        </div>

                        <div class="info_item"><span>当月担保发生额:</span><b>*</b>
                            <input type="text" name="dydbfsje"  />
                        </div>
                    </div>

                    <div>
                        <div class="info_item"><span>当月担保发生笔数:</span><b>*</b>
                            <input type="text" name="dyfsbs" />
                        </div>

                        <div class="info_item"><span>在保笔数:</span><b>*</b>
                            <input type="text" name="zbbs" />
                        </div>
                    </div>

                </div>
            </div>
            <div class="panel_footer">
                <div>
                    <input type="submit" value="保存" class="btn_blue" id="btn_save"/>
                    <input type="button" value="返回" class="btn_blue" id="btn_back"/>
                </div>
            </div>
        </form>
    </div>
</div>

<script type="text/javascript">

    function goBack(){
        linkTo("${ctx}/guarantee/toGuarantee");
    }

    $(function () {

        $('#sjsj').datepicker({
            changeMonth: true,
            changeYear: true,
            dateFormat: 'yymm'
        });
        $('#dbksrq').datepicker();
        $('#dbdqrq').datepicker();

        $("#btn_back").bind("click",goBack);

        $("#formId").validate({
//            rules:{
//                zzjgdm: "required",
//                qymc: "required"
//            },
//            messages:{
//                businessDate: "业务时间必填",
//                businessType: "业务类型必选"
//            },
            submitHandler: function(form) {
                $(form).ajaxSubmit({
                    success: function(response) {
                        $.prompt("保存成功");
                        window.setTimeout(function(){
                            goBack();
                        },2000);
                    },

                    error: function(response){
                        $.prompt("保存失败:"+response,"错误");
                    }
                });
            }
        });
    });

</script>

